$mongoPath = "C:\Program Files\MongoDB\server\bin"

$currentPath = [System.Environment]::GetEnvironmentVariable("Path", [System.EnvironmentVariableTarget]::Machine)

if ($currentPath -notcontains $mongoPath) {
    $newPath = $currentPath + ";" + $mongoPath
    [System.Environment]::SetEnvironmentVariable("Path", $newPath, [System.EnvironmentVariableTarget]::Machine)
    Write-Host "MongoDB path has been added to the system PATH."
} else {
    Write-Host "MongoDB path is already in the system PATH."
}